package com.job.shuang.HomeWork0705;

import com.job.shuang.HomeWork0705.Student0705;

/**
 * @author liushuang
 * @version 1.0
 * @since 2022-07-06 11:30:43
 */
public class StudentSystem0705 {
    public static void main(String[] args){
        int min=100,max=0,sum=0;
        Student0705[] st = new Student0705[5];
        st[0] = new Student0705(19,"刘爽","女",99);
        st[1] = new Student0705(19,"张三","男",98);
        st[2] = new Student0705(20,"李四","男",97);
        for(int i=0;i<st.length;i++){
            System.out.println("年龄："+st[i].sAge+st[i].sName+st[i].sSex+ st[i].getsJava());
            if(st[i].getsJava() <min){
                min = st[i].getsJava();//成绩最小值
            }
            if(st[i].getsJava() >max){
                max = st[i].getsJava();//成绩最大值
            }
            sum = sum+ st[i].getsJava();//成绩平均值
        }
        System.out.println("最小值："+min+"最大值："+max+"平均值："+sum/st.length);


        st[1]=null;//空指针异常
        System.out.println("张三的java成绩为："+ st[1].getsJava());
        //此处Exception in thread "main" java.lang.NullPointerException
    }
}


